home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / mx / remoting / PendingCall.as < prev    next >
Text File  |  2007-11-08  |  2KB  |  61 lines

  1. class mx.remoting.PendingCall extends Object
  2. {
  3.    static var inited = mx.remoting.NetServiceProxy.registerNetServiceProxy();
  4.    function PendingCall(srv, methodName)
  5.    {
  6.       super();
  7.       this.__service = srv;
  8.       this.__methodName = methodName;
  9.    }
  10.    function get responder()
  11.    {
  12.       return this.__responder;
  13.    }
  14.    function set responder(res)
  15.    {
  16.       this.__responder = res;
  17.    }
  18.    function onResult(result)
  19.    {
  20.       result.serviceName = result.serviceName;
  21.       if(result != null)
  22.       {
  23.          if(result instanceof mx.remoting.NetServiceProxy)
  24.          {
  25.             var _loc4_ = new mx.remoting.Service(null,null,result.serviceName,this.__service.__get__connection(),this.__service.__get__responder());
  26.             result = _loc4_;
  27.          }
  28.          else if(result instanceof mx.remoting.RecordSet)
  29.          {
  30.             var _loc3_ = new mx.remoting.NetServiceProxy(this.__service.__get__connection());
  31.             result._setParentService(_loc3_);
  32.             result.logger = this.__service.log;
  33.          }
  34.       }
  35.       if(this.__responder != null)
  36.       {
  37.          this.__responder.onResult(new mx.rpc.ResultEvent(result));
  38.       }
  39.       if(this.__service.log != null)
  40.       {
  41.          this.__service.log.logInfo(this.__service.__get__name() + "." + this.__methodName + "() returned " + mx.data.binding.ObjectDumper.toString(result));
  42.       }
  43.    }
  44.    function onStatus(status)
  45.    {
  46.       if(this.__responder != null)
  47.       {
  48.          this.__responder.onFault(new mx.rpc.FaultEvent(new mx.rpc.Fault(status.code,status.description,status.details,status.type)));
  49.       }
  50.       if(this.__service.log != null)
  51.       {
  52.          this.__service.log.logDebug("Service invocation failed.");
  53.          this.__service.log.logDebug(this.__service.__get__name() + "." + this.__methodName + "() returned " + mx.data.binding.ObjectDumper.toString(status));
  54.       }
  55.    }
  56.    function get methodName()
  57.    {
  58.       return this.__methodName;
  59.    }
  60. }
  61.